package study.cdc.debezium.support.runner;

import io.debezium.config.Configuration;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.connect.json.JsonConverter;
import org.springframework.context.annotation.Bean;

@Slf4j
@org.springframework.context.annotation.Configuration
public class DebeziumEmbeddedConfig {

    @Bean
    public JsonConverter keyConverter(Configuration embeddedConfig) {
        JsonConverter converter = new JsonConverter();
        converter.configure(embeddedConfig.asMap(), true);

        return converter;
    }

    @Bean
    public JsonConverter valueConverter(Configuration embeddedConfig) {
        JsonConverter converter = new JsonConverter();
        converter.configure(embeddedConfig.asMap(), false);
        return converter;
    }
}
